Disk partitioning

Disk partitioning is the act of dividing a hard disk drive into multiple logical storage units referred to as partitions, to treat one physical disk drive as if it were multiple disks. Partitions are also termed "slices" for operating systems based on BSD, Solaris or GNU Hurd. A partition editor software program can be used to create, resize, delete, and manipulate these partitions on the hard disk.

Contents

Benefits of multiple partitions

Creating more than one partition has the following advantages:

  • For example a 1 TB disk might have an access time of 12 ms at 200 IOPS (at a limited queue depth) with an average throughput of 100 MB/s. When it is partitioned to 100 GB (and the rest left unallocated) you might end up with an access time of 6 ms at 300 IOPS (with a bigger queue depth) with an average throughput of 200 MB/s.

Disadvantages of multiple partitions

Creating more than one partition has the following disadvantages, as compared to having a single partition spanning the same disk area:

PC partition types

This section describes the master boot record (MBR) partitioning scheme, as used in DOS, Microsoft Windows and Linux among others on PC compatible computer systems. For examples of partitioning schemes used in other operating systems, see the general article on partition tables.

The total data storage space of a PC hard disk can be divided into at most four primary partitions, or alternatively three primary partitions and an extended partition. These partitions are described by 16-byte entries that constitute the Partition Table, located in the master boot record.

The partition type is identified by a 1-byte code found in its partition table entry. Some of these codes (such as 0x05 and 0x0F) may be used to indicate the presence of an extended partition. Most are used by an operating system's bootloader (that examines partition tables) to decide if a partition contains a file system that can be used to mount / access for reading or writing data.

Primary partition

A primary partition contains one file system. In DOS and earlier versions of Microsoft Windows systems, the system partition was required to be the first partition. More recent Windows operating systems (Win7, XP, etc.) can be located on any partition, but the boot files (bootmgr, ntldr, etc.) must be on a primary partition. However, other factors, such as a PC's BIOS (see Boot sequence on standard PC) may also impart specific requirements as to which partition must contain the primary OS.

The partition type code for a primary partition can either correspond to a file system contained within (e.g. 0x07 means either an NTFS or an OS/2 HPFS file system) or indicate that the partition has a special use (e.g. code 0x82 usually indicates a Linux swap partition). The FAT16 and FAT32 file systems have made use of a number of partition type codes due to the limits of various DOS and Windows OS versions. Though a Linux operating system may recognize a number of different file systems (ext4, ext3, ext2, ReiserFS, etc.), they have all consistently used the same partition type code: 0x83 (Linux native file system).

Extended partition

A hard disk may contain only one extended partition; the extended partition can be subdivided into multiple logical partitions. In DOS/Windows systems, each logical partition may then be assigned an additional drive letter.

Partitioning schemes

DOS, Windows, and OS/2

With DOS, Microsoft Windows, and OS/2, a common practice is to use one primary partition for the active file system that will contain the operating system, the page/swap file, all utilities, applications, and user data. On most Windows consumer computers, the drive letter C: is routinely assigned to this primary partition. Other partitions may exist on the hard disk that may or may not be visible as drives, such as recovery partitions or partitions with diagnostic tools or data. (Microsoft drive letters do not correspond to partitions in a one-to-one fashion, so there may be more or fewer drive letters than partitions.)

Microsoft Windows 2000, XP, Vista, and Windows 7 include a 'Disk Management' program which allows for the creation, deletion and resizing of FAT and NTFS partitions. The Windows 7/Vista Disk Manager is not compatible with Windows 2000, XP and many other non-Microsoft operating systems.

Unix, Linux, and Mac OS X

On Unix-based and Unix-like operating systems such as Linux or Mac OS X, it is possible to use multiple partitions on a disk device. Each partition can be formatted with a file system or as a swap partition.

Multiple partitions allow directories such as /tmp, /usr, /var, or /home to be allocated their own filesystems. Such a scheme has a number of advantages:

A common default for Linux desktop systems is to use two partitions: one holding a file system mounted on "/" (the root directory) and a swap partition.

By default, Mac OS X systems also use a single partition for the entire filesystem and use a swap file inside the file system (like Windows) rather than a swap partition.

Multi-boot and mixed-boot systems

Multi-boot systems are computers where the user can boot into one of two or more distinct operating systems (OS) stored in separate storage devices or in separate partitions of the same storage device. In such systems a menu at startup gives a choice of which OS to boot/start (and only one OS at a time is loaded).

This is distinct from virtual operating systems, in which one operating system is run as a self-contained virtual "program" within another already-running operating system. (An example is a Linux OS "virtual machine" running from within a Windows OS).

Partition recovery

When a partition is deleted, its entry is removed from a table and the data is no longer accessible. The data remains on the disk until being overwritten. Specialized recovery utilities, (such as TestDisk and gpart), may be able to locate lost file systems and recreate a partition table which includes entries for these recovered file systems. Some disk utilities may overwrite a number of beginning sectors of a partition they delete. For example, if Windows Disk Management (Windows 2000/XP, etc.) is used to delete a partition, it will overwrite the first sector (relative sector 0) of the partition before removing it. It still may be possible to restore a FAT32 or NTFS partition if a backup boot sector is available.

Compressed disks

Hard disks can be compressed to create additional space. In DOS and early Microsoft Windows, programs such as Stacker (DR-DOS except 6), SuperStor (DR-DOS 6), DoubleSpace, or DriveSpace (Windows 95) were used. This compression was done by creating a very large file on the partition, then storing the disk's data in this file. At startup, device drivers opened this file and assigned it a separate letter. Frequently, to avoid confusion, the original partition and the compressed drive had their letters swapped, so that the compressed disk is C:, and the uncompressed area (often containing system files) is given a higher name.

Versions of Windows using the NT kernel, including the most recent versions, XP and Vista, contain intrinsic disk compression capability. The use of separate disk compression utilities has declined sharply.

See also

References

  1. ^ Accelerate Your Hard Drive By Short Stroking
  2. ^ [1]
  3. ^ http://www.computorcompanion.com/LPMArticle.asp?ID=326
  4. ^ http://books.google.co.uk/books?id=OuPtI5fHhBoC&lpg=PA172&ots=YFbyBztASR&pg=PA178#v=onepage
  5. ^ http://superuser.com/questions/36378/advantages-disadvantages-of-partitioning-a-drive/36381#36381
  6. ^ http://technet.microsoft.com/en-us/library/dd560753(WS.10).aspx#BKMK_UnderstandHardlinkMig

Further reading

External links